//
//  BaseCollectionView.m
//  待定
//
//  Created by dllo on 15/11/11.
//  Copyright © 2015年 BoyaLee. All rights reserved.
//

#import "BaseCollectionView.h"

@implementation BaseCollectionView

-(instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
{
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
        
        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"night"])
        {
            self.backgroundColor = BGNIGHTMODEL;
        }
        else
        {
            self.backgroundColor = BGDAYMODEL;
        }
    }
    return self;
}


-(void)changeColor:(NSNotification *)notification
{
    
    NSString *str = [notification object];
    if ([str isEqualToString:@"no"])
    {
        self.backgroundColor = BGDAYMODEL;
    }
    else
    {
        self.backgroundColor = BGNIGHTMODEL;
    }
   
    
}


@end
